﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SemesterProjekt
{
    /// <summary>
    /// Interaktionslogik für MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        /*
         * registration -> i want information .. sensor.ValueChanged += HandleValueChanged
         * Handling -> what do wehne information is recieved .. public void HandleValueChanged(object sender, XArgs ..)
         * 
         * */

        private Sensor sensor;


        private void sensor_ValueChanged(object sender, ValueChangedEventArgs args)
        {
            txtValue.Text = args.NewValue.ToString();

        }

        public MainWindow()
        {
            InitializeComponent();
            sensor = new Sensor();
            sensor.ValueChanged += sensor_ValueChanged;

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            sensor.Measure();
        }
    }
}
